//
//  UIToolBar+DSLib.m
//  DS_PJ_01
//
//  Created by admin on 16/8/18.
//  Copyright © 2016年 zhiqiyun. All rights reserved.
//

#import "UIToolBar+DSLib.h"

#define kToolBarHeight 44

@implementation UIToolbar(DSLib)

+ (UIToolbar *)customToolbarForView:(UIView *)view {
    UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:
                          CGRectMake(0, view.size.height - kToolBarHeight, view.width, kToolBarHeight)];
    
    // UIToolbar has a weird margin. this *slightly* expands the toolbar to look consistent with the navbar
#define kToolBarExtraMargin 7
    toolbar.width = toolbar.width + kToolBarExtraMargin * 2;
    toolbar.left = toolbar.left - kToolBarExtraMargin;
    
    toolbar.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth;
    [view addSubview:toolbar];
    return toolbar;
}


@end
